<template>
  <div class="greetings">
    <h1 class="green">{{ msg }}</h1>
    <h3>
      You’ve successfully created a project with
      <a href="https://vite.dev/" target="_blank" rel="noopener">Vite</a> +
      <a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>.
    </h3>
    <ul>
      <li v-for="item in list" :key="item.id">
        <!--        这里 后端返回了唯一值id，就用唯一值，没有返回就用index-->
        {{ item.name }}-----{{ item.age }}
      </li>
    </ul>
  </div>
</template>

<script lang="ts" setup name="hello">
import type {Person} from "@/components/Person.ts";
import {withDefaults} from "vue";

withDefaults(defineProps<{
      msg: string,
      list?: Array<Person>
    }>(), {
      list: () => [
        {id: 4, name: "赵六", age: 18},
        {id: 5, name: "苏七", age: 20},
        {id: 6, name: "王八", age: 33}
      ]
    }
)
import {ref, defineExpose} from "vue";

let a = ref('a')
let b = ref('b')
let c = ref('c')

defineExpose({a, b, c})
</script>

<style scoped>
h1 {
  font-weight: 500;
  font-size: 2.6rem;
  position: relative;
  top: -10px;
}

h3 {
  font-size: 1.2rem;
}

.greetings h1,
.greetings h3 {
  text-align: center;
}

@media (min-width: 1024px) {
  .greetings h1,
  .greetings h3 {
    text-align: left;
  }
}
</style>
